UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ssUIlYVwK6db61KDTBHNCf08AnC9LkrX0ldg3s4zT8c=' 
WHERE 
  key_id = 'ec9e5162c78074a05fff7505c21ea13be326e09e32a623a7f79660359e1e2a36' 
  AND (
    token = 'ssUIlYVwK6db61KDTBHNCf08AnC9LkrX0ldg3s4zT8c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037