UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pQrzVA0SS5wtTlwF9+5/bzsN7ez8ClLaM+/ixxeIGeY=' 
WHERE 
  key_id = '74130faa9ed25f0dfa30af39e64221622b2289d130531c727d6dda08dd7dd6c6' 
  AND (
    token = 'pQrzVA0SS5wtTlwF9+5/bzsN7ez8ClLaM+/ixxeIGeY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034