UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YDjrweruA84jeyGCextOqEZsCsRXPc+fdRlXSMhF0r0='
WHERE
key_id = 'cd5f5f5489c0e05a6914b4fac65893dc378a5748731a1f90ae49fcbdcde42efe'
AND (
token = 'YDjrweruA84jeyGCextOqEZsCsRXPc+fdRlXSMhF0r0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)