UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6Y10ztGBkltyugnGflRH3XObRybKR76oMDoRFFajGV8='
WHERE
key_id = 'aab28ed040d0d3d1745fc20a5c6705f9cec68edb491af713dee2b51131c02d3a'
AND (
token = '6Y10ztGBkltyugnGflRH3XObRybKR76oMDoRFFajGV8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)