UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PqEFq5KSyBkzhFBPpd34yQGMwcftmwUuF0K6yCZAybo='
WHERE
key_id = '38d0d59d21afcbd52c488311feb4bd72080ae4957498e3877f2199cb195ef2bc'
AND (
token = 'PqEFq5KSyBkzhFBPpd34yQGMwcftmwUuF0K6yCZAybo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)