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

Query time 0.00033