UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dw824gaBkD1QCxX6ghQTyXzg1ljfphelqGvPbLj7n+Q=' 
WHERE 
  key_id = '76b9eb80724b78002595bdd682501c625f02815fdb16b508e0442395f427c31c' 
  AND (
    token = 'Dw824gaBkD1QCxX6ghQTyXzg1ljfphelqGvPbLj7n+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030