UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uaHZmMAL6eHag/bz/QgDqentj3wSeIv3XJafaetxYpU='
WHERE
key_id = '506f0c41f3171549a084d9a31a02801144c77060e7e829c3d6e694a7370fd08c'
AND (
token = 'uaHZmMAL6eHag/bz/QgDqentj3wSeIv3XJafaetxYpU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)