UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hW8iHGUzGTwjA7G9GqP5ffA4AkCZX87lCcD3PKgFfBs='
WHERE
key_id = 'e318eb38d56bedb0d989861629195d692f45ae045ddcc1870c06a85f53f30430'
AND (
token = 'hW8iHGUzGTwjA7G9GqP5ffA4AkCZX87lCcD3PKgFfBs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)