UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jjyBAtRGB6qtS8SOzT7uFk1sQ6RfMFxA9L2qqWSjtiY=' 
WHERE 
  key_id = '17f55c0e2b6798ee88f161a7696741a69151e7660dec8e94ee5d832d9bae3eec' 
  AND (
    token = 'jjyBAtRGB6qtS8SOzT7uFk1sQ6RfMFxA9L2qqWSjtiY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035