UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xa5v6qR/B8QwUhPDMB8ig6uZVAU7Nqb26nW2WFOn34c='
WHERE
key_id = 'a259f5e8d3f3ad1f65e749f1801bd99734131249281ef07d1d501dc31d15ea8b'
AND (
token = 'xa5v6qR/B8QwUhPDMB8ig6uZVAU7Nqb26nW2WFOn34c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)