UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mIOrnM67O88geuGXAf6xcUyCZ+sMEzT1vPwnnOi/mPU='
WHERE
key_id = 'aa818aa90e34c805bfe09d7c279b9d33e5195dbd0c5b2599290eeb89eaefae47'
AND (
token = 'mIOrnM67O88geuGXAf6xcUyCZ+sMEzT1vPwnnOi/mPU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)