UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KsP4/YyfkvCu3dE1mUPMUOsUQbVUtpa9MaJw56UUA+k=' 
WHERE 
  key_id = 'c7132e6cf856102c86addb5bfe4c87badf8da4c798381e93e3cea1d37094bfa8' 
  AND (
    token = 'KsP4/YyfkvCu3dE1mUPMUOsUQbVUtpa9MaJw56UUA+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036