UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XmRr4u+KqL02tU37OlJeVPwdbKjOjwNqbvkOIXUydRA='
WHERE
key_id = 'e010cd8431f68410d4dba2b3651aa747cf7f8fa0cf19ad7d466a5cde1015d783'
AND (
token = 'XmRr4u+KqL02tU37OlJeVPwdbKjOjwNqbvkOIXUydRA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)