UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gfw3MizkPuraRuIu5fcMlopho+WtZtwQe17YHM3fCNU=' 
WHERE 
  key_id = '880e86ede8b3498b36b928dae7f1a0d7144575c9513ef97127f96f70d4aa542b' 
  AND (
    token = 'gfw3MizkPuraRuIu5fcMlopho+WtZtwQe17YHM3fCNU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030