UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gabf0osHmY5/HvQOOb1dixuUQ2Q/8n1nru9phA1H7/Y=' 
WHERE 
  key_id = '12ce107ff8d6065914da3371512342024de8e9cf2417e2d3a6a0bbcfd0f48198' 
  AND (
    token = 'Gabf0osHmY5/HvQOOb1dixuUQ2Q/8n1nru9phA1H7/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041