UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h5qOyuokjdkus+EOpAgygDcOP9t1BDp5m8rr3muLAaE=' 
WHERE 
  key_id = '7fa0ed09732159ec437654d3792457492493ce2b978e7d6a3a2895ae2ea700e1' 
  AND (
    token = 'h5qOyuokjdkus+EOpAgygDcOP9t1BDp5m8rr3muLAaE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044