UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mDQvEyqgnGcz8d6uFFe2nFV5yy3q9yx46VY+8igpJd8='
WHERE
key_id = '0ec1915ffd3462fa3d0154b992511c178a9d5ea66e4ca45258010df263518dd9'
AND (
token = 'mDQvEyqgnGcz8d6uFFe2nFV5yy3q9yx46VY+8igpJd8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)