UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xN/BZjpNNaQrALUdKnpciYvDD6o9ZKc0dY3CerdEMA8='
WHERE
key_id = '5824d2276d122b430ee79ec62859bdd318bfe00e99ecba26847dd7262f0b9372'
AND (
token = 'xN/BZjpNNaQrALUdKnpciYvDD6o9ZKc0dY3CerdEMA8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)