UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fo1bVOR9f27Kwo6PoqiT/mJ2XNAyOgswjtqA8ryfSXQ=' 
WHERE 
  key_id = '6434b785e6e958ce0794ad26538c9761afbee89089c4cce79bbf6834bf277703' 
  AND (
    token = 'fo1bVOR9f27Kwo6PoqiT/mJ2XNAyOgswjtqA8ryfSXQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032