UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '58Gv1S3TNf1fLzIidHO3u0b6eGDDiul4IxOV7hpWqN8='
WHERE
key_id = 'e1153f206073dab961316442440122ee4de0137825f0426e9720b0feab31344d'
AND (
token = '58Gv1S3TNf1fLzIidHO3u0b6eGDDiul4IxOV7hpWqN8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)