UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FBEoxT+27MAir2VCDFCtkyTqqWheZy9qfZmdxIrSSuk=' 
WHERE 
  key_id = '5373714f8b3fe5bde328b052b532f810dc9c28837db6f76d868edf910edd3133' 
  AND (
    token = 'FBEoxT+27MAir2VCDFCtkyTqqWheZy9qfZmdxIrSSuk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034