UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6TdNpZAja83ruVY0MdH4dhYcnOTU9bkVjbj1q1qiGLo='
WHERE
key_id = '81d8c010d6c67032c6cfd5fd496597770986f16ef7ebd42adb9804ef8c6b167a'
AND (
token = '6TdNpZAja83ruVY0MdH4dhYcnOTU9bkVjbj1q1qiGLo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)