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