UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w0on+Ghsl165xlMbkjOW9TgDM8xFoRR0bbwemm5obQ4='
WHERE
key_id = '4bd4e4a8250015dfaa3cfd77dbc7277b572b12f3534304c9a6651635bca76381'
AND (
token = 'w0on+Ghsl165xlMbkjOW9TgDM8xFoRR0bbwemm5obQ4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)