UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TjyncprTCXYxPFKEYvIYkXZhnScTprSTWYLEWzcu/78=' 
WHERE 
  key_id = 'e5d63c30e53678891f722a631872a9bee737df6f6629795f8acb05dee08b0587' 
  AND (
    token = 'TjyncprTCXYxPFKEYvIYkXZhnScTprSTWYLEWzcu/78=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036