UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WnxJEvjO9PaktUXlMaGTpulZ1qE1Wc0b6YF1/h8YvAY=' 
WHERE 
  key_id = 'da7709598b220534d6089ef85657085148f28d4637425c2e6d7f9c0970a97458' 
  AND (
    token = 'WnxJEvjO9PaktUXlMaGTpulZ1qE1Wc0b6YF1/h8YvAY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020