UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bnic7q6Dud/w5eoZyiulKEm1lfeXRua7d324IUGQezU=' 
WHERE 
  key_id = '10a3585856f43d74769cea52d75262fd86aec13460cca4bf86a97a03cc43fe25' 
  AND (
    token = 'Bnic7q6Dud/w5eoZyiulKEm1lfeXRua7d324IUGQezU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051