UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v1QYg7Aw7S4xnT9CeV0oDh2QPF+fT0v42J1okBqYPk8='
WHERE
key_id = '585de2cd122edee1faf4ea450f3f08fe79c40cf3f284b27097b1c9f539b8c120'
AND (
token = 'v1QYg7Aw7S4xnT9CeV0oDh2QPF+fT0v42J1okBqYPk8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)