UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sSwhIYLx8MnEXUSZGbX+R38YJGKabisQPMqTo5Cz4EI='
WHERE
key_id = '8c52fc2586e181dacd0a6a5db514506e780ed194daa560220f3577bfd01f759a'
AND (
token = 'sSwhIYLx8MnEXUSZGbX+R38YJGKabisQPMqTo5Cz4EI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)