UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jpQQFjNcHrc7Jy17jlfVhICpAPopw09vvfKChA+goMU='
WHERE
key_id = 'd2c83dcffdd5aacd6696417d6bf2c64fe640ef0bb0cbd7aeb9f4940f552df370'
AND (
token = 'jpQQFjNcHrc7Jy17jlfVhICpAPopw09vvfKChA+goMU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)