UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fhZSCCGQaJQdRs7OO4jeg/WsR4yJUFHwqsGdBnAeGT8='
WHERE
key_id = '849264ec0ce1e658260adf807c5b688a6a21714b3a5797286d0120212afd652f'
AND (
token = 'fhZSCCGQaJQdRs7OO4jeg/WsR4yJUFHwqsGdBnAeGT8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)