UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9rn/S26hSIk2fk5kgBteAUVGeFauMM87bFzF8cat3nA=' 
WHERE 
  key_id = 'f9dc776f9a77aa012a8fb5611f4fcf53732e8ae4583b9fe6ec9559be7bbae59b' 
  AND (
    token = '9rn/S26hSIk2fk5kgBteAUVGeFauMM87bFzF8cat3nA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029