UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I52wonM72aLZZvXB8EBeHw1hh94KNRQnp0d1GqTk5Kc=' 
WHERE 
  key_id = 'b87deae23056fe47988f6f10bf4bcf31557d3f293ff09dd45969028878ea2d36' 
  AND (
    token = 'I52wonM72aLZZvXB8EBeHw1hh94KNRQnp0d1GqTk5Kc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016