UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd7Y7cOvh3pZdsUEEbSJP6WOIb13xHlDnfKIUtlZP+Ws='
WHERE
key_id = '0cd7354d5bad88b63ab65a94e65597f4463c2bc4fef993a6b1fb8cf022ca9bad'
AND (
token = 'd7Y7cOvh3pZdsUEEbSJP6WOIb13xHlDnfKIUtlZP+Ws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)