UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BFjxl4LHl8vcyom465SloPWl//8/BAWXrtzn8Enh1og='
WHERE
key_id = 'b793898ca492fd6d3d7968fcc33e52742a5215898574837a7f5109b2876fdd81'
AND (
token = 'BFjxl4LHl8vcyom465SloPWl//8/BAWXrtzn8Enh1og='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)