UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bkmz08IXKS4O38MYU07m8WrYMXA0i27+ptWxibHPGiI=' 
WHERE 
  key_id = 'fd045a5a382c3d7266694d67f88fef19a7ebea2990b73f99d48c2cd7d44c4854' 
  AND (
    token = 'bkmz08IXKS4O38MYU07m8WrYMXA0i27+ptWxibHPGiI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041