UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0gKZRniqrVez0jXcPG12Bo9U98bKnhIyjK57Gwz6EcU=' 
WHERE 
  key_id = '0c822d226247b57c7dc8db562e0362abfb4472fc4d395f2dfda6cebec583b2c8' 
  AND (
    token = '0gKZRniqrVez0jXcPG12Bo9U98bKnhIyjK57Gwz6EcU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031