UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PvpAbvfTG78UJ6mCGxmJe6vfd7O6nurEb8oUD6TQ3HQ='
WHERE
key_id = '5e407ef3462ab635f66a2a30748b8b7786af2d1a89e1418bc7f96744501b0427'
AND (
token = 'PvpAbvfTG78UJ6mCGxmJe6vfd7O6nurEb8oUD6TQ3HQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)