UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+pRNuMGm6in21bQcxtvqiNuf55jmJnTTtiVPTyxH47Q=' 
WHERE 
  key_id = '9d3b5feb6172c0e183285b2758b8671971fc5902a67129f2ebaa95b6642d1f09' 
  AND (
    token = '+pRNuMGm6in21bQcxtvqiNuf55jmJnTTtiVPTyxH47Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036