UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2yyYDssxT8X0dSUfHzvEmusNn4cpXXhcHRzZZdP1aww=' 
WHERE 
  key_id = '9c12c0e340b890c445f0d1848b321e66082789f4892c0a695ddaf4dcd2e292cb' 
  AND (
    token = '2yyYDssxT8X0dSUfHzvEmusNn4cpXXhcHRzZZdP1aww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048